package com.fir.my.batis.plus.task;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import java.io.IOException;

@Configuration
@EnableScheduling
@Slf4j
public class WatchTask {
    @Autowired
    WatchServiceDemo_Access watchServiceDemo;

    @Scheduled(cron = "0/5 * * * * ?")
    private void myTasks() throws IOException {
        if(!Watch.isRun){
            log.info("access mdb文件监听启动..." );
            watchServiceDemo.init();
            log.info("access mdb文件监已启动." );
        }
    }
}
